package com.girlbook.controllers;

import com.girlbook.bean.Chen;

import net.paoding.rose.web.Invocation;
import net.paoding.rose.web.paramresolver.ParamMetaData;
import net.paoding.rose.web.paramresolver.ParamResolver;

public class ChenBeanResolver implements ParamResolver
{

	public Object resolve(Invocation inv, ParamMetaData metaData)
			throws Exception
	{
		for (String paramName : metaData.getParamNames())
		{
			if (paramName != null)
			{
				Chen chen = new Chen();
				String value1 = inv.getParameter("chen1");
				String value2 = inv.getParameter("chen2");
				chen.setChen1(value1);
				chen.setChen2(value2);
				return chen;
			}
		}
		return null;

	}

	public boolean supports(ParamMetaData metaData)
	{
		return Chen.class == metaData.getParamType();
	}

}
